from .base import Base
from .common import CommonMixin
from sqlalchemy import ForeignKey, Integer, Column
from sqlalchemy.orm import relationship

""" 角色资源表 """


class RoleResource(Base, CommonMixin):
    __tablename__ = 'role_resource'

    id = Column(Integer, primary_key=True, comment='主键ID', autoincrement=True)
    role_id = Column(ForeignKey("role.id"), comment="角色id")
    resource_id = Column(ForeignKey("resource.id"), comment="资源id")

    resource = relationship("Resource", back_populates="role_resource")
